package ioperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOperation{
    @Override
    public void word(BookList bookList) {
        System.out.println("请输入要归还的书籍的名字");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();

        for (int i = 0; i < bookList.getUseSize(); i++) {
            if(name.equals(bookList.getPosBook(i).getName())){
                Book book = bookList.getPosBook(i);
                book.setBorrow(false);
                System.out.println("归还成功");
                return;
            }
        }
        System.out.println("找不到你要归还的书籍");
    }
}
